/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * UseCaseGUI.java
 *
 * Created on Sep 10, 2009, 3:02:51 PM
 */
package gui;

import java.io.FileNotFoundException;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.swing.DefaultCellEditor;
import javax.swing.JOptionPane;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.event.TableModelEvent;
import javax.swing.table.TableModel;
import javax.swing.text.Document;

import Controller.DiagramController;
import Controller.UseCaseController;
import edu.uta.cse5322_2011_team3.UCController;

/**
 * 
 * @author Sean
 */
public class UseCaseGUI extends javax.swing.JFrame implements
		java.io.Serializable {

	/** Creates new form UseCaseGUI */
	public UseCaseGUI() {
		initComponents();
		colorText = new ColorPane();
		jScrollPane1.setViewportView(colorText);
		JTextField cell = new JTextField();
		useCaseTable.getColumnModel().getColumn(0)
				.setCellEditor(new DefaultCellEditor(cell));
		useCaseTable.getColumnModel().getColumn(1)
				.setCellEditor(new DefaultCellEditor(cell));
		useCaseTable.getColumnModel().getColumn(2)
				.setCellEditor(new DefaultCellEditor(cell));
		useCaseTable.getColumnModel().getColumn(3)
				.setCellEditor(new DefaultCellEditor(cell));
		useCaseTable.setEnabled(true);
		useCaseTable.getColumnModel().getColumn(0).getCellEditor()
				.addCellEditorListener(useCaseTable);
		useCaseTable.getColumnModel().getColumn(1).getCellEditor()
				.addCellEditorListener(useCaseTable);
		useCaseTable.getColumnModel().getColumn(2).getCellEditor()
				.addCellEditorListener(useCaseTable);
		useCaseTable.getColumnModel().getColumn(3).getCellEditor()
				.addCellEditorListener(useCaseTable);

	}

	/** Invoke GUI Use CaseController */
	public UseCaseController evntController = new UseCaseController();
	/** Invoke GUI Diagram Controller */
	public DiagramController dEvntController = new DiagramController();
	public DrawPanel dPane;

	private UCController ucController = new UCController();

	/**
	 * This method is called from within the constructor to initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is always
	 * regenerated by the Form Editor.
	 */
	// @SuppressWarnings("unchecked")
	// GUI Design
	// <editor-fold defaultstate="collapsed"
	// desc="Generated Code">//GEN-BEGIN:initComponents
	private void initComponents() {

		jTabbedPane1 = new javax.swing.JTabbedPane();
		jPanel1 = new javax.swing.JPanel();
		jScrollPane1 = new javax.swing.JScrollPane();
		reqTextPane = new javax.swing.JTextPane();
		deriveButton = new javax.swing.JButton();
		verbButton = new javax.swing.JButton();
		actorButton = new javax.swing.JButton();
		systemButton = new javax.swing.JButton();
		jScrollPane2 = new javax.swing.JScrollPane();
		useCaseTable = new javax.swing.JTable();
		jButton4 = new javax.swing.JButton();
		nounButton = new javax.swing.JButton();
		jButton1 = new javax.swing.JButton();
		automaticIdentifyingButton = new javax.swing.JButton();
		automaticColoringButton = new javax.swing.JButton();
		helpButton = new javax.swing.JButton();
		jMenuBar1 = new javax.swing.JMenuBar();
		jMenu1 = new javax.swing.JMenu();
		jMenuItem1 = new javax.swing.JMenuItem();
		jMenuItem2 = new javax.swing.JMenuItem();
		jSeparator1 = new javax.swing.JSeparator();
		jMenuItem3 = new javax.swing.JMenuItem();
		jMenu2 = new javax.swing.JMenu();
		jMenuItem4 = new javax.swing.JMenuItem();
		jSeparator2 = new javax.swing.JSeparator();
		jMenuItem5 = new javax.swing.JMenuItem();
		jMenuItem6 = new javax.swing.JMenuItem();
		jMenuItem7 = new javax.swing.JMenuItem();

		setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
		setTitle("Use Case Factory");
		setBackground(java.awt.SystemColor.control);
		setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
		setFocusCycleRoot(false);
		setForeground(java.awt.Color.lightGray);

		reqTextPane.setFont(new java.awt.Font("Times New Roman", 0, 12));
		reqTextPane.setEnabled(false);
		jScrollPane1.setViewportView(reqTextPane);

		deriveButton.setText("Derive Use Case");
		deriveButton.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				deriveButtonActionPerformed(evt);
			}
		});

		verbButton.setForeground(new java.awt.Color(255, 0, 0));
		verbButton.setText("Verb");
		verbButton.setEnabled(false);
		verbButton.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				verbButtonActionPerformed(evt);
			}
		});

		actorButton.setForeground(new java.awt.Color(0, 102, 0));
		actorButton.setText("Actor");
		actorButton.setEnabled(false);
		actorButton.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				actorButtonActionPerformed(evt);
			}
		});

		systemButton.setForeground(new java.awt.Color(0, 0, 255));
		systemButton.setText("System");
		systemButton.setEnabled(false);
		systemButton.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				systemButtonActionPerformed(evt);
			}
		});

		useCaseTable.setModel(model);
		useCaseTable.setRowSelectionAllowed(false);
		jScrollPane2.setViewportView(useCaseTable);

		jButton4.setText("Generate Diagram");
		jButton4.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jButton4ActionPerformed(evt);
			}
		});

		nounButton.setForeground(new java.awt.Color(255, 0, 0));
		nounButton.setText("Noun");
		nounButton.setEnabled(false);
		nounButton.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				nounButtonActionPerformed(evt);
			}
		});

		jButton1.setText("Update from Table");
		jButton1.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jButton1ActionPerformed(evt);
			}
		});

		automaticIdentifyingButton.setText("Automatic Identifying");
		automaticIdentifyingButton.setEnabled(false);
		automaticIdentifyingButton
				.addActionListener(new java.awt.event.ActionListener() {
					public void actionPerformed(java.awt.event.ActionEvent evt) {
						automaticIdentifyingButtonActionPerformed(evt);
					}
				});

		automaticColoringButton.setText("Automatic Coloring");
		automaticColoringButton.setEnabled(false);
		automaticColoringButton
				.addActionListener(new java.awt.event.ActionListener() {
					public void actionPerformed(java.awt.event.ActionEvent evt) {
						automaticColoringButtonActionPerformed(evt);
					}
				});

		helpButton.setText("Help");
		helpButton.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				helpButtonActionPerformed(evt);
			}
		});

		javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(
				jPanel1);
		jPanel1.setLayout(jPanel1Layout);
		jPanel1Layout
				.setHorizontalGroup(jPanel1Layout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								javax.swing.GroupLayout.Alignment.TRAILING,
								jPanel1Layout
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												jPanel1Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.TRAILING)
														.addComponent(
																jScrollPane1,
																javax.swing.GroupLayout.Alignment.LEADING,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																840,
																Short.MAX_VALUE)
														.addComponent(
																jScrollPane2,
																javax.swing.GroupLayout.Alignment.LEADING,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																840,
																Short.MAX_VALUE)
														.addGroup(
																javax.swing.GroupLayout.Alignment.LEADING,
																jPanel1Layout
																		.createSequentialGroup()
																		.addComponent(
																				deriveButton,
																				javax.swing.GroupLayout.PREFERRED_SIZE,
																				170,
																				javax.swing.GroupLayout.PREFERRED_SIZE)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																		.addComponent(
																				actorButton)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																		.addComponent(
																				verbButton,
																				javax.swing.GroupLayout.PREFERRED_SIZE,
																				67,
																				javax.swing.GroupLayout.PREFERRED_SIZE)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																		.addComponent(
																				nounButton)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																		.addComponent(
																				systemButton)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.RELATED,
																				73,
																				Short.MAX_VALUE)
																		.addComponent(
																				automaticColoringButton)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																		.addComponent(
																				automaticIdentifyingButton)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																		.addComponent(
																				helpButton))
														.addGroup(
																javax.swing.GroupLayout.Alignment.LEADING,
																jPanel1Layout
																		.createSequentialGroup()
																		.addComponent(
																				jButton4,
																				javax.swing.GroupLayout.PREFERRED_SIZE,
																				170,
																				javax.swing.GroupLayout.PREFERRED_SIZE)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.RELATED,
																				470,
																				Short.MAX_VALUE)
																		.addComponent(
																				jButton1,
																				javax.swing.GroupLayout.PREFERRED_SIZE,
																				200,
																				javax.swing.GroupLayout.PREFERRED_SIZE)))
										.addContainerGap()));
		jPanel1Layout
				.setVerticalGroup(jPanel1Layout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								javax.swing.GroupLayout.Alignment.TRAILING,
								jPanel1Layout
										.createSequentialGroup()
										.addContainerGap()
										.addComponent(
												jScrollPane1,
												javax.swing.GroupLayout.DEFAULT_SIZE,
												323, Short.MAX_VALUE)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												jPanel1Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
														.addComponent(
																deriveButton)
														.addComponent(
																actorButton)
														.addComponent(
																verbButton)
														.addComponent(
																nounButton)
														.addComponent(
																systemButton)
														.addComponent(
																automaticIdentifyingButton)
														.addComponent(
																automaticColoringButton)
														.addComponent(
																helpButton))
										.addGap(10, 10, 10)
										.addComponent(
												jScrollPane2,
												javax.swing.GroupLayout.PREFERRED_SIZE,
												156,
												javax.swing.GroupLayout.PREFERRED_SIZE)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												jPanel1Layout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
														.addComponent(jButton4)
														.addComponent(jButton1))
										.addGap(11, 11, 11)));

		jTabbedPane1.addTab("Derive Use Case", jPanel1);

		jMenu1.setText("File");

		jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
				java.awt.event.KeyEvent.VK_O,
				java.awt.event.InputEvent.CTRL_MASK));
		jMenuItem1.setText("Open");
		jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jMenuItem1ActionPerformed(evt);
			}
		});
		jMenu1.add(jMenuItem1);

		jMenuItem2.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
				java.awt.event.KeyEvent.VK_N,
				java.awt.event.InputEvent.CTRL_MASK));
		jMenuItem2.setText("New");
		jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jMenuItem2ActionPerformed(evt);
			}
		});
		jMenu1.add(jMenuItem2);
		jMenu1.add(jSeparator1);

		jMenuItem3.setText("Close");
		jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jMenuItem3ActionPerformed(evt);
			}
		});
		jMenu1.add(jMenuItem3);

		jMenuBar1.add(jMenu1);

		jMenu2.setText("Diagram");
		jMenu2.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jMenu2ActionPerformed(evt);
			}
		});

		jMenuItem4.setText("Generate Diagram");
		jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jMenuItem4ActionPerformed(evt);
			}
		});
		jMenu2.add(jMenuItem4);
		jMenu2.add(jSeparator2);

		jMenuItem5.setText("OpenDiagram");
		jMenuItem5.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jMenuItem5ActionPerformed(evt);
			}
		});
		jMenu2.add(jMenuItem5);

		jMenuItem6.setText("Save");
		jMenuItem6.setEnabled(false);
		jMenuItem6.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jMenuItem6ActionPerformed(evt);
			}
		});
		jMenu2.add(jMenuItem6);

		jMenuItem7.setText("Save as image");
		jMenuItem7.setEnabled(false);
		jMenuItem7.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				jMenuItem7ActionPerformed(evt);
			}
		});
		jMenu2.add(jMenuItem7);

		jMenuBar1.add(jMenu2);

		setJMenuBar(jMenuBar1);

		javax.swing.GroupLayout layout = new javax.swing.GroupLayout(
				getContentPane());
		getContentPane().setLayout(layout);
		layout.setHorizontalGroup(layout.createParallelGroup(
				javax.swing.GroupLayout.Alignment.LEADING).addComponent(
				jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 865,
				Short.MAX_VALUE));
		layout.setVerticalGroup(layout.createParallelGroup(
				javax.swing.GroupLayout.Alignment.LEADING).addComponent(
				jTabbedPane1));

		pack();
	}// </editor-fold>//GEN-END:initComponents

	public void tableChanged(TableModelEvent e) {
		int row = e.getFirstRow();
		int column = e.getColumn();
		TableModel model = (TableModel) e.getSource();
		String columnName = model.getColumnName(column);
		Object data = model.getValueAt(row, column);
		useCaseTable.setValueAt(data, row, column);
		// Do something with the data...
	}

	// private void (javax.swing.event.CellEditorListener l)) {
	// System.exit(0);// TODO add your handling code here:
	// }
	private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_jMenuItem3ActionPerformed
		System.exit(0);// TODO add your handling code here:
	}// GEN-LAST:event_jMenuItem3ActionPerformed

	private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_jMenuItem1ActionPerformed
		evntController.Open(colorText, automaticColoringButton);

		// enable color button
//		automaticIdentifyingButton.setEnabled(true);
	}// GEN-LAST:event_jMenuItem1ActionPerformed

	private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_jMenuItem2ActionPerformed
		evntController.Enable(colorText);
	}// GEN-LAST:event_jMenuItem2ActionPerformed

	private void deriveButtonActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_deriveButtonActionPerformed
		if (helpMode)
			displayMessage("This button helps in framing the use cases");
		else
			evntController.startUseCase(actorButton, verbButton, systemButton,
					deriveButton, model, useCaseTable, nounButton, automaticIdentifyingButton); 
		helpMode = false;
	}// GEN-LAST:event_deriveButtonActionPerformed

	private void actorButtonActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_actorButtonActionPerformed
		if (helpMode)
			displayMessage(" This button lets you find out who is the Actor from the requirement document");
		else
			evntController.actorPressed(colorText, actorButton, verbButton,
					systemButton, deriveButton, useCaseTable, this, nounButton); // TODO
																					// add
																					// your
																					// handling
																					// code
																					// here:
		helpMode = false;

	}// GEN-LAST:event_actorButtonActionPerformed

	private void verbButtonActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_verbButtonActionPerformed
		if (helpMode)
			displayMessage("This button helps in finding out the verb from the requirement document");
		else
			evntController.verbPressed(colorText, actorButton, verbButton,
					systemButton, deriveButton, useCaseTable, this, nounButton);// TODO
																				// add
																				// your
																				// handling
																				// code
																				// here:
		helpMode = false;

	}// GEN-LAST:event_verbButtonActionPerformed

	private void systemButtonActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_systemButtonActionPerformed
		if (helpMode)
			displayMessage("This button helps to find out the System involved from the requirement document");
		else
			evntController.systemPressed(colorText, actorButton, verbButton,
					systemButton, deriveButton, useCaseTable, this, nounButton);// TODO
																				// add
																				// your
																				// handling
																				// code
																				// here:
		helpMode = false;

	}// GEN-LAST:event_systemButtonActionPerformed

	private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_jButton4ActionPerformed
		if (helpMode)
			displayMessage("This button generates the necessary table according to the requirement document based vernoun phrases, actor, system etc ");
		else {
			dPane = new DrawPanel(jTabbedPane1);
			dEvntController
					.generatePressed(jTabbedPane1, dPane, evntController);// TODO
																			// add
																			// your
																			// handling
																			// code
																			// here:
			// dEvntController.drawUseCase(dPane, null);
			jMenuItem5.setEnabled(true);
			jMenuItem6.setEnabled(true);
			jMenuItem7.setEnabled(true);
		}
		helpMode = false;

	}// GEN-LAST:event_jButton4ActionPerformed

	private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_jMenuItem4ActionPerformed
		if (helpMode) {

			JOptionPane.showMessageDialog(null,
					"Geneate Diagram generates use case diagram");
		} else {

			dPane = new DrawPanel(jTabbedPane1);
			dEvntController
					.generatePressed(jTabbedPane1, dPane, evntController);
			// dEvntController.drawUseCase(dPane, null);
			jMenuItem5.setEnabled(true);
			jMenuItem6.setEnabled(true);
			jMenuItem7.setEnabled(true);

		}

		helpMode = false;

	}// GEN-LAST:event_jMenuItem4ActionPerformed

	private void nounButtonActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_nounButtonActionPerformed
		if (helpMode)
			displayMessage("This button helps in creating nouns");
		else
			evntController.nounPressed(colorText, actorButton, verbButton,
					systemButton, deriveButton, useCaseTable, this, nounButton);// TODO
																				// add
																				// your
																				// handling
																				// code
																				// here:
		helpMode = false;
	}// GEN-LAST:event_nounButtonActionPerformed

	private void jMenu2ActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_jMenu2ActionPerformed
	}// GEN-LAST:event_jMenu2ActionPerformed

	private void jMenuItem7ActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_jMenuItem7ActionPerformed
		try {
			dEvntController.saveAsPressed(dPane);
			// TODO add your handling code here:
		} catch (FileNotFoundException ex) {
			Logger.getLogger(UseCaseGUI.class.getName()).log(Level.SEVERE,
					null, ex);
		}
		// TODO add your handling code here:
	}// GEN-LAST:event_jMenuItem7ActionPerformed

	private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_jMenuItem6ActionPerformed
		dEvntController.savePressed(dPane, this, useCaseTable);
	}// GEN-LAST:event_jMenuItem6ActionPerformed

	private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_jMenuItem5ActionPerformed
		dEvntController.openDiagramPressed(dPane, this);// TODO add your
														// handling code here:
		dPane = new DrawPanel(jTabbedPane1);
		dEvntController.generatePressed(jTabbedPane1, dPane, evntController);
		// dEvntController.drawUseCase(dPane, null);
		jMenuItem5.setEnabled(true);
		jMenuItem6.setEnabled(true);
		jMenuItem7.setEnabled(true);
	}// GEN-LAST:event_jMenuItem5ActionPerformed

	private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
		if (helpMode) {
			displayMessage(" Update the contents from the table");
			helpMode = false;
		} else {// GEN-FIRST:event_jButton1ActionPerformed
			evntController.updateFromTablePressed(useCaseTable);
		}
	}// GEN-LAST:event_jButton1ActionPerformed

	private void automaticColoringButtonActionPerformed(
			java.awt.event.ActionEvent evt) {// GEN-FIRST:event_automaticColoringButtonActionPerformed

		if (helpMode) {
			displayMessage(" This button colors the verbs, nouns and verb-noun phrases automatically from the requirement document");
			helpMode = false;
		} else {
			ucController.performColor(this.colorText);
		}

	}// GEN-LAST:event_automaticColoringButtonActionPerformed

	private void automaticIdentifyingButtonActionPerformed(
			java.awt.event.ActionEvent evt) {// GEN-FIRST:event_automaticIdentifyingButtonActionPerformed

		if (helpMode) {
			displayMessage("This button helps in identifying the actor, system and usecases automatically");
			helpMode = false;
		} else {
			ucController.performIdentify(this.colorText);
			ucController.showUsecases(model);
		}
	}

	// GEN-LAST:event_automaticIdentifyingButtonActionPerformed
	private void helpButtonActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_helpButtonActionPerformed
		helpMode = true;
	}// GEN-LAST:event_helpButtonActionPerformed

	/**
	 * @param args
	 *            the command line arguments
	 */
	public static void main(String args[]) {
		java.awt.EventQueue.invokeLater(new Runnable() {

			public void run() {
				new UseCaseGUI().setVisible(true);

			}
		});
	}

	private static int useCaseCount = -1;

	public static int getUseCaseCount() {
		return useCaseCount;
	}

	public static void setUseCaseCount(int count) {
		useCaseCount = count;
	}

	public static void incUseCaseCount() {
		useCaseCount++;
	}

	private UseCaseTableModel model = new UseCaseTableModel(new Object[][] {},
			new String[] { "Actor", "Verb Noun Phrase", "System", "Verified" },
			this);
	// Variables declaration - do not modify//GEN-BEGIN:variables
	private javax.swing.JButton actorButton;
	private javax.swing.JButton automaticColoringButton;
	private javax.swing.JButton automaticIdentifyingButton;
	private javax.swing.JButton deriveButton;
	private javax.swing.JButton helpButton;
	private javax.swing.JButton jButton1;
	private javax.swing.JButton jButton4;
	private javax.swing.JMenu jMenu1;
	private javax.swing.JMenu jMenu2;
	private javax.swing.JMenuBar jMenuBar1;
	private javax.swing.JMenuItem jMenuItem1;
	private javax.swing.JMenuItem jMenuItem2;
	private javax.swing.JMenuItem jMenuItem3;
	private javax.swing.JMenuItem jMenuItem4;
	private javax.swing.JMenuItem jMenuItem5;
	private javax.swing.JMenuItem jMenuItem6;
	private javax.swing.JMenuItem jMenuItem7;
	private javax.swing.JPanel jPanel1;
	private javax.swing.JScrollPane jScrollPane1;
	private javax.swing.JScrollPane jScrollPane2;
	private javax.swing.JSeparator jSeparator1;
	private javax.swing.JSeparator jSeparator2;
	private javax.swing.JTabbedPane jTabbedPane1;
	private javax.swing.JButton nounButton;
	private javax.swing.JTextPane reqTextPane;
	private javax.swing.JButton systemButton;
	private javax.swing.JTable useCaseTable;
	private javax.swing.JButton verbButton;
	// End of variables declaration//GEN-END:variables
	private gui.ColorPane colorText;
	boolean helpMode = false;

	public JTabbedPane getjTabbedPane1() {
		return jTabbedPane1;
	}

	public JTable getUCTable() {
		return (this.useCaseTable);
	}

	public Document getColorText() {
		return (this.colorText.getDocument());
	}

	public void setColorText(Document tPane) {
		this.colorText.setDocument(tPane);
	}

	public void setUCTableModel(UseCaseTableModel ucTblModel) {
		this.model = ucTblModel;
		useCaseTable.setModel(model);
		jScrollPane2.setViewportView(useCaseTable);
	}

	private void displayMessage(String s) {
		JOptionPane.showMessageDialog(this, s);
	}
}